<?php

namespace App\Http\Requests;

class Replies extends Base
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'nickname'   => [
                'required',
                'alpha_num',
                'between:4,12',
            ],

            'email'      => [
                'email',
            ],

            'content'    => [
                'required',
            ],

            'article_id' => [
                'required',
                'numeric',

            ],

            'captcha'    => [
                'required',
                'captcha',
            ],
        ];
    }

    public function messages()
    {
        return [
            'nickname.required'    => '请填写账号！',
            'nickname.alpha_num'   => '昵称可以是字母数字！',
            'nickname.between'     => '昵称长度范围4-12！',

            'email.email'         => '请填写正确邮箱信息！',

            'content.required'    => '请填写内容',

            'article_id.required' => '请选择要回复的文章',
            'article_id.required' => '请选择要回复的文章',

            'captcha.required'    => '请填写验证码！',
            'captcha.captcha'     => '请填写正确的验证码！',
        ];
    }
}
